home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_lib.arc / PCEXIT.C < prev    next >
Text File  |  1990-08-09  |  958b  |  37 lines

  1. /**
  2. *
  3. *  Name         pcexit -- Terminate the process and set the exit code
  4. *
  5. *  Synopsis     pcexit(excode);
  6. *               unsigned excode   Exit code to set
  7. *
  8. *  Description  This function terminates the current process an sets
  9. *               the exit code.  The exit code can be inspected by the
  10. *               parent process using the PCWAIT function, or at the
  11. *               DOS level by using the ERRORLEVEL batch command.
  12. *               Notice that the exit code can be no greater than 255
  13. *               or less than 0.
  14. *
  15. *  Version      1.1  (C)Copyright Blaise Computing Inc.  1983, 1984
  16. *
  17. **/
  18. #define utbyword(a,b)   (((a)<<8)|((b)&0x00ff))  /* a is high, b low   */
  19.  
  20. struct dreg
  21. {
  22.   unsigned ax,bx,cx,dx,si,di,ds,es;
  23. };
  24. #define DOSREG  struct dreg
  25.  
  26. int pcexit(excode)
  27. unsigned excode;
  28. {
  29.     DOSREG dos_reg;
  30.  
  31.     utinit(&dos_reg);
  32.     dos_reg.ax = utbyword(0x4c,excode);
  33.  
  34.     return(dos(&dos_reg));
  35.  
  36. }
  37.